from typing import *


class Solution:
    def goodSubsetofBinaryMatrix(self, grid: List[List[int]]) -> List[int]:
        s = {}
        limit = 1 << len(grid[0])
        for j, row in enumerate(grid):
            c = 0
            for i, v in enumerate(row):
                c |= v << i
            if c == 0:
                return [j]
            for i in range(limit):
                if i & c == 0 and i in s:
                    return [s.get(i), j]
            s[c] = j
        return []


c = [[[0, 1, 1, 0], [0, 0, 0, 1], [1, 1, 1, 1]], [[0]], [[1, 1, 1], [1, 1, 1]]]
s = Solution()
for i in c:
    print(s.goodSubsetofBinaryMatrix(i))
